//
//  MyDog.m
//  NSSecureCodingDemoo
//
//  Created by hpkj on 2020/1/19.
//

#import "MyDog.h"

@implementation MyDog

+(BOOL)supportsSecureCoding
{
    return YES;
}

-(instancetype)initWithCoder:(NSCoder *)coder
{
    if (self = [super init]) {
        if (coder) {
            _name = [coder decodeObjectOfClass:[NSString class] forKey:@"name"];
            _age = [coder decodeIntegerForKey:@"age"];
        }
    }
    return self;
}

-(void)encodeWithCoder:(NSCoder *)coder
{
    [coder encodeObject:_name forKey:@"name"];
    [coder encodeInteger:_age forKey:@"age"];
}


@end
